<!DOCTYPE html>
<html>
<head>
    <title>海逸售货柜测试</title>
    <style>
        .result-pre {
            word-wrap: break-word; /* 确保长单词或长字符串在必要时自动换行 */
            white-space: pre-wrap; /* 保留空白符序列，并且在必要时自动换行 */
            max-width: 500px; /* 设置最大宽度 */
        }
        #messages {
            width: 500px;
            height: 200px;
            border: 1px solid #ccc;
            overflow-y: scroll;
            padding: 10px;
        }
    </style>
</head>
<body>
    <li> <a href="http://dingtest.ddzn.tech:8000/open" target="_blank"> 点击跳转开锁页 </a> </li>
    <div id="messages"></div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js"></script>
    <script>
        var socket = io();
        socket.on('message', function(data) {
            var messagesDiv = document.getElementById('messages');
            var messageElement = document.createElement('p');
            messageElement.textContent = data.data;
            messagesDiv.appendChild(messageElement);

            // 自动滚动到底部
            messagesDiv.scrollTop = messagesDiv.scrollHeight;
        });
    </script>
    <form method="post">
        <label > ==========⬇️️⬇️⬇️生成请求数据/接口调用 ⬇️⬇️️⬇️️========== </label><br>
        <label for="json_data">输入JSON 只包含value部分,如: {"merchantNo":"Me00003282","productNo":"CATALOG"}</label><br>
        <textarea id="json_data" name="json_data" rows="10" cols="70">  </textarea>
        <button type="submit" name="action" value="gen_haiyi_value">生成数据</button><br>
        <input type="text" id="url" name="url" value="catalog/list">
        <button type="submit" name="action" value="post_haiyi">POST请求 </button><br>
        <label > ==========⬇️️⬇️⬇️点击直接获取 ⬇️⬇️️⬇️️========== </label><br>
        {% for key, (value, description, path) in buttons.items() %}
        <button type="submit" name="action" value="{{ key }}">{{ description }}🔸 {{ path }}</button>
        {% endfor %} <br>
        <label > ==========⬇️️⬇️⬇️获取订单视频 ⬇️⬇️️⬇️️========== </label><br>
        <label > 订单ID: </label> <input type="text" id="order_no" name="order_no">
        <button type="submit" name="action" value="post_orderid">order/orderVideo🔸 2.4.7 获取订单视频 </button><br>
    </form>
    {% if order_video %}
    <h2>orderVideo:</h2>
    <pre class="result-pre">{{ order_video | safe }}</pre>
    {% endif %}

    {% if post_data %}
    <h2>PostData:</h2>
    <pre class="result-pre">{{ post_data | safe }}</pre>
    {% endif %}

    {% if result %}
    <h2>Result:</h2>
    <pre>{{ result | safe }}</pre>
    {% endif %}
</body>
</html>
